home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / dev / mui / mui37_de.lha / Amiga-E / Examples / Pages.e < prev    next >
Text File  |  1996-08-25  |  4KB  |  163 lines

  1. /*
  2. **  Original C Code written by Stefan Stuntz
  3. **
  4. **  Translation into E by Klaus Becker
  5. **
  6. **  All comments are from the C-Source
  7. */
  8.  
  9. OPT PREPROCESS
  10.  
  11. /*
  12. ** Loading the needed MODULEs
  13. */
  14.  
  15. MODULE 'tools/domethod'
  16. MODULE 'muimaster', 'libraries/mui'
  17. MODULE 'utility/tagitem', 'utility/hooks'
  18. MODULE 'intuition/classes', 'intuition/classusr'
  19. MODULE 'libraries/gadtools'
  20.  
  21. ENUM ER_NON, ER_MUILIB, ER_APP          /* for the exception handling */
  22.  
  23. /*
  24. ** DEFining the var s
  25. */
  26.  
  27. DEF app,window,sex,pages
  28. DEF races,classes
  29.  
  30.  
  31. /*
  32. ** main()
  33. */
  34.  
  35. PROC main() HANDLE
  36.  
  37. DEF signal, running, result
  38.  
  39. /*
  40. ** Open the muimaster.library
  41. */
  42.    sex:=['male','female',NIL]
  43.    pages:=['Race','Class','Armor','Level',NIL]
  44.    races:=['Human','Elf','Dwarf','Hobbit','Gnome',NIL]
  45.    classes:=['Warrior','Rogue','Bard','Monk','Magician','Archmage',NIL]
  46.  
  47.    IF (muimasterbase := OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN))=NIL THEN Raise(ER_MUILIB)
  48.  
  49.     app:= ApplicationObject,
  50.       MUIA_Application_Title      , 'Pages-Demo',
  51.       MUIA_Application_Version    , '$VER: Pages-Demo 10.11 (23.12.94)',
  52.       MUIA_Application_Copyright  , ' 1992/93, Stefan Stuntz',
  53.       MUIA_Application_Author     , 'Stefan Stuntz & Klaus Becker',
  54.       MUIA_Application_Description, 'Show MUIs Page Groups',
  55.       MUIA_Application_Base       , 'PAGESDEMO',
  56.       SubWindow, window:= WindowObject,
  57.         MUIA_Window_Title, 'Character Definition',
  58.         MUIA_Window_ID   , "PAGE",
  59.         WindowContents, VGroup,
  60.           Child, ColGroup(2),
  61.             Child, Label2('Name:'), Child, StringMUI('Frodo',32),
  62.             Child, Label1('Sex:' ), Child, Cycle(sex),
  63.           End,
  64.           Child, VSpace(2),
  65.           Child, RegisterGroup(pages),
  66.             MUIA_Register_Frame, MUI_TRUE,
  67.             Child, HCenter(Radio(NIL,races)),
  68.             Child, HCenter(Radio(NIL,classes)),
  69.             Child, HGroup,
  70.               Child, HSpace(0),
  71.               Child, ColGroup(2),
  72.                 Child, Label1('Cloak:' ), Child, CheckMark(MUI_TRUE),
  73.                 Child, Label1('Shield:'), Child, CheckMark(MUI_TRUE),
  74.                 Child, Label1('Gloves:'), Child, CheckMark(MUI_TRUE),
  75.                 Child, Label1('Helmet:'), Child, CheckMark(MUI_TRUE),
  76.               End,
  77.               Child, HSpace(0),
  78.             End,
  79.             Child, ColGroup(2),
  80.               Child, Label('Experience:'  ), Child, Slider(0,100, 3),
  81.               Child, Label('Strength:'    ), Child, Slider(0,100,42),
  82.               Child, Label('Dexterity:'   ), Child, Slider(0,100,24),
  83.               Child, Label('Condition:'   ), Child, Slider(0,100,39),
  84.               Child, Label('Intelligence:'), Child, Slider(0,100,74),
  85.             End,
  86.           End,
  87.         End,
  88.       End,
  89.     End
  90.  
  91.  
  92.   IF app=NIL THEN Raise(ER_APP)
  93.  
  94. /*
  95. ** Closing the master window forces a complete shutdown of the application.
  96. */
  97.  
  98.    doMethod(window,[MUIM_Notify,MUIA_Window_CloseRequest,MUI_TRUE,app,2,MUIM_Application_ReturnID,MUIV_Application_ReturnID_Quit])
  99.  
  100.  
  101. /*
  102. ** Everything's ready, lets launch the application. We will
  103. ** open the master window now.
  104. */
  105.  
  106.    set(window,MUIA_Window_Open,MUI_TRUE)
  107.  
  108.  
  109. /*
  110. ** This is the main loop. As you can see, it does just nothing.
  111. ** Everything is handled by MUI, no work for the programmer.
  112. **
  113. ** The only thing we do here is to react on a double click
  114. ** in the volume list (which causes an ID_NEWVOL) by setting
  115. ** a new directory name for the directory list. If you want
  116. ** to see a real file requester with MUI, wait for the
  117. ** next release of MFR :-)
  118. */
  119.  
  120.  
  121.    running := TRUE  
  122.  
  123.    WHILE running
  124.  
  125.       result := doMethod(app, [MUIM_Application_Input, {signal} ])
  126.  
  127.       SELECT result
  128.  
  129.         CASE MUIV_Application_ReturnID_Quit
  130.         running := FALSE
  131.  
  132.       ENDSELECT
  133.  
  134.       IF signal THEN Wait(signal)
  135.  
  136.    ENDWHILE
  137.  
  138. /*
  139. ** Call the exception handling with ER_NON, this will dispose the
  140. ** application object, close "muimaster.library" and end the program.
  141. */
  142.  
  143. EXCEPT DO
  144.   IF app THEN Mui_DisposeObject(app)
  145.   IF muimasterbase THEN CloseLibrary(muimasterbase)
  146.   
  147.   SELECT exception
  148.     CASE ER_MUILIB
  149.       WriteF('Failed to open \s.\n',MUIMASTER_NAME)
  150.       CleanUp(20)
  151.  
  152.     CASE ER_APP
  153.       WriteF('Failed to create application.\n')
  154.       CleanUp(20)
  155.       
  156.   ENDSELECT
  157. ENDPROC 0
  158.  
  159.  
  160. /*
  161. ** This is the end...
  162. */
  163.